<template>
  <div>
    <van-nav-bar
        title="限时秒杀"
        left-text="返回"
        left-arrow
        @click-left="onClickLeft"
        @click-right="onClickRight"
    >
      <template #right>
        <van-icon name="setting-o" color="black" size="20" />
      </template>
    </van-nav-bar>
    <van-tabs v-model="active">
      <van-tab title="全部"><all></all></van-tab>
      <van-tab title="正在进行"><conduct></conduct></van-tab>
      <van-tab title="即将开始"><soon></soon></van-tab>
      <van-tab title="已售罄"><out></out></van-tab>
    </van-tabs>
  </div>
</template>

<script>
import { Toast } from 'vant';
import all from "@/components/index/seckill/all";
import conduct from "@/components/index/seckill/conduct";
import out from "@/components/index/seckill/out";
import soon from "@/components/index/seckill/soon";
export default {
name: "father",
  components:{
    all,
    conduct,
    out,
    soon,
  },
  data() {
    return {
      active: 0,
    };
  },
  methods: {
    onClickLeft() {
      Toast('返回');
      this.$router.go(-1);
    },
    onClickRight() {
      Toast('按钮');
    },
    //日期转换为具体的毫秒数
    dDate(DateOne, DateTwo) {
      //两个时间的天数差(DateOne 较小的时间, DateTwo 较大的时间，日期类型：2016-06-16)
      var OneMonth = DateOne.substring(5, DateOne.lastIndexOf('-'));
      var OneDay = DateOne.substring(8, 10);
      var Ones = DateOne.substring(11, 13);
      var OneF = DateOne.substring(14, 16);
      var OneM = DateOne.substring(17, 19);
      var OneYear = DateOne.substring(0, DateOne.indexOf('-'));

      var TwoMonth = DateTwo.substring(5, DateTwo.lastIndexOf('-'));
      var TwoDay = DateTwo.substring(8, 10);
      var Twos = DateTwo.substring(11, 13);
      var TwoF = DateTwo.substring(14, 16);
      var TwoM = DateTwo.substring(17, 19);
      var TwoYear = DateTwo.substring(0, DateTwo.indexOf('-'));
      var OneC=Ones*60*60*1000+OneF*60*1000+OneM*1000;
      var TwoC=Twos*60*60*1000+TwoF*60*1000+TwoM*1000;
      let cha1=OneC-TwoC;
      var cha2 = (Date.parse(TwoMonth + '/' + TwoDay + '/' + TwoYear) - Date.parse(OneMonth + '/' + OneDay + '/' + OneYear));
      let cha=cha1+cha2;
      // var cha = (Date.parse(TwoMonth + '/' + TwoDay + '/' + TwoYear) - Date.parse(OneMonth + '/' + OneDay + '/' + OneYear)) / (24 * 60 * 60 * 1000);
      return cha;
      // console.log(cha);
      //return Math.abs(cha); //返回差值绝对值
    },
  }
}
</script>
<style>
ul li{
  list-style-type: none;
  margin-top: 8px;
}
.van-card{
  text-align: left;
  align-content: center;
}
.van-count-down{
  color: red;
}
.box{
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
.box>div:first-child{
  display: flex;
  align-items: center;
  width: 20%;
  justify-content: space-around;
}
.box>div:first-child>span>span{
  color: red;
}
</style>